<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>百度定位</title>
<style type="text/css">
body, html, #allmap {
	width: 100%;
	height: 100%;
	overflow: hidden;
	margin: 0;
}
#golist {
	display: none;
}

@media (max-device-width: 800px) {
#golist {
	display: block!important;
}
}
#geo {
	z-index: 99999
}
</style>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
	
</script>
<script src="http://api.map.baidu.com/components?ak=QMDvD2Anle2gLOINIBUZ1Lhh&v=1.0"></script>
</head>
<body>
<lbs-map center="{$info.mapapi}" style="height:91%" id="lbsmap"></lbs-map>
<script type="text/javascript">
 
 
var url="{:U('Member/Vcard/updateadd')}";

	var lbsGeo = document.createElement('lbs-geo');
	lbsGeo.addEventListener("geofail",function(evt){ //注册事件
 		alert("定位失败，请手动设置");
	});
	
	lbsGeo.addEventListener("geosuccess",function(evt){ //注册
		var addr = evt.detail.coords;
		var x = addr.lng;
		var y = addr.lat;
		var zb=x+','+y;
		
		if(confirm("定位成功,是否要设置此坐标" + zb)){
			
		setTimeout(function(){
		var map=$(".locbar-txt").html();
		$.post(url,{coords:zb,maps:map},function(data){
		if(data.status == 1){
			alert('已提交位置');
 			
		}else{ alert('提交失败');}
	},'json');
			
			},1000)	
		
 	
	} 
	
	});
 
	lbsGeo.setAttribute("enable-modified","true");
	lbsGeo.setAttribute("id","geo");
	document.body.appendChild(lbsGeo);
	
</script>
</body>
</html>
